import Vue from 'vue'
import Vuex from 'vuex';//中央状态管理器的构建对象
// console.log(Vuex);

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        msg:"不良帅袁天罡",
        num1:1234,
        num2:2345,
        arr:[1,2,3,4,5],
        user:{
            name:"林志颖",
            age:47
        }
    },
    getters:{
        getSum:function(state){
            console.log(state);
            return state.num1+state.num2;
        }
    },
    mutations: {
        setMsg(state,nv){
            if(nv.length==0){
                return;
            }
            state.msg=nv+"爱你";
        }
    },
    actions: {

    }
})
